SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO


CREATE PROCEDURE dbo.[DnnProduct_GetTabCount]
	
	@PortalId	int

AS

DECLARE @AdminTabId int
SET @AdminTabId = (SELECT AdminTabId 
						FROM dbo.DnnProduct_vw_Portals 
						WHERE PortalID = @PortalID)

SELECT COUNT(*) - 1 
FROM  dbo.DnnProduct_Tabs
WHERE (PortalID = @PortalID) 
	AND (TabID <> @AdminTabId) 
	AND (ParentId <> @AdminTabId OR ParentId IS NULL)
GO
